#!/user/bin/env node

let timer1,timer2;
let i =1;

console.log("timer1 is start");
timer1 = setInterval(loop1,500);
setTimeout(()=>{
  console.log("timer1 is end");
  clearInterval(timer1);
  console.log("timer2 is start");
  timer2 = setInterval(loop2,500);
},5000);

function loop1(){
  console.log("timer1 is working");
}

function loop2(){
  if(i<6){
    console.log("timer2 is working:" + i);
  }else{
    clearInterval(timer2);
  }
  i++;
}
